package String_;

/**
 * @author 王艺锡
 * @version 1.0
 */

public class Exercise01 {
    public static void main(String[] args) {
        String a = "jack";
        String b = new String("jack");
        System.out.println(a.equals(b));//T
        System.out.println(a==b);//F
        //inter()方法，如果常量池中有字符串jack，则返回字符串jack的地址
        System.out.println(a == b.intern());//T
        System.out.println(b == b.intern());//F


        Person p1 = new Person();
        p1.name = "lihua";
        Person p2 = new Person();
        p2.name = "lihua";
        System.out.println(p1.name == p2.name);//T
        System.out.println(p1.name == "lihua");//T
    }
}

class Person{
    public String name;
}
